﻿var Url = "AjaxData/CustomOperating.aspx";
//自动义双击方法
function CustomDbClick() {
    window.parent.$("#tabs").tabs('close', '查看客户信息');
    var recordID = myDataTable.getSelectedRows()[0];
    record = myDataTable.getRecord(recordID);
    var vid = record.getData(const_entityID);
    var pagetitle = "查看客户信息";
    parent.addTabs(pagetitle, '../Crm/Customer/AddCustomerInfo.aspx?r=' + Math.random() + '&type=3&flag=0&entity=CrmCustomerInfo&id=' + vid + '&title=' + encodeURI(pagetitle));
    parent.NeedRefreshPage = this;
}
//自定义新增方法
var fnCustomAdd = function () {
}
//自定义修改方法
var fnCustomEdit = function () {
}
//自定义删除方法
var fnCustomDeleteData = function () {
    YAHOO.example.container.dialog3.hide();
}
//启用客户
var fnRunCustomer = function () {
    var recordID = myDataTable.getSelectedRows()[0];
    var record = myDataTable.getRecord(recordID);
    var vid = record.getData(const_entityID);
    if (vid != "") {
        if (confirm("您确定启用将该客户吗?")) {
            var SaveUrl = Url + "?r=" + Math.random() + "&action=delete&entity=CrmCustomerInfo&type=1&json=&id=" + vid;
            YAHOO.util.Connect.asyncRequest('POST', SaveUrl, {
                success: function (res) {
                    try {
                        var str = res.responseText;
                        if (str == "1") {
                            alert("启用客户成功!");
                            RefreshData();
                        }
                        else {
                            alert(str + "\n" + "操作失败!");
                        }
                    }
                    catch (e) {
                    }
                    finally {
                    }
                },
                failure: function (error) {
                    alert("数据错误：" + error.statusText);
                }
            }, null);
        }
    }
}

if (typeof ($) == "undefined") { //屏蔽右键
    parent.unContextMenu(document);
    /*$(document).ready(function () { 
    if (typeof (parent.unContextMenu) == "function") {
    parent.unContextMenu(document);
    }
    if (typeof (parent.parent.unContextMenu) == "function") {
    parent.parent.unContextMenu(document);
    }
    });*/
}
if (typeof (YAHOO) == "undefined") {
    parent.unContextMenu(document);
}